﻿@using SimpleFramework.Web.Navigation
@using System.Text
@model NavigationViewModel
@addTagHelper *, SimpleFramework.Module.Navigation
@if (Model.HasVisibleChildren(Model.RootNode))
{
    <ul class="nav navbar-nav">
        <li cwn-data-attributes="@Model.RootNode.Value.DataAttributes" class='@Model.GetClass(Model.RootNode.Value)'><a href="@Url.Content(Model.AdjustUrl(Model.RootNode))">@Html.Raw(Model.GetIcon(Model.RootNode.Value))@Model.AdjustText(Model.RootNode)</a></li>

        @foreach (var node in Model.RootNode.Children)
        {
            if (!Model.ShouldAllowView(node)) { continue; }
            if (!Model.HasVisibleChildren(node))
            {
                <li class='@Model.GetClass(node.Value)' cwn-data-attributes="@node.Value.DataAttributes"><a href="@Url.Content(Model.AdjustUrl(node))">@Html.Raw(Model.GetIcon(node.Value))@Model.AdjustText(node)</a></li>
            }
            else
            {

                <li class='@Model.GetClass(node.Value, "dropdown")' cwn-data-attributes="@node.Value.DataAttributes">  
                    <a href="@Url.Content(Model.AdjustUrl(node))">@Html.Raw(Model.GetIcon(node.Value))@Model.AdjustText(node) <span class="caret"></span></a>
                    @Model.UpdateTempNode(node)@Html.Partial("NavigationNodeChildDropdownPartial", Model)
                </li>
            }
        }
    </ul>
}
